package com.aaa.ssm.service.impl;

import com.aaa.ssm.dao.SeasonDao;
import com.aaa.ssm.entity.Season;
import com.aaa.ssm.service.SeasonService;
import com.aaa.ssm.util.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SeasonServiceImpl implements SeasonService {
    @Resource
    private SeasonDao seasonDao;

    @Override
    public List<Season> queryAll() {
        return seasonDao.queryAll();
    }

    @Override
    public PageInfo queryPage(Page<Season> page) {
        PageHelper.startPage(page.getPageNo(),page.getPageSize());
        return new PageInfo(seasonDao.queryByParam(page.getData()));
    }

    @Override
    public int add(Season season) {
        return seasonDao.add(season);
    }

    @Override
    public int update(Season season) {
        return seasonDao.update(season);
    }

    @Override
    public int deleteById(int code) {
        return seasonDao.deleteById(code);
    }
}
